package cn.iocoder.yudao.module.bpm.dal.mysql.oaleavapplysub;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.oaleavapplysub.vo.OaLeavApplySubPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oaleavapplysub.OaLeavApplySubDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 请假申请 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface OaLeavApplySubMapper extends BaseMapperX<OaLeavApplySubDO> {

    default List<OaLeavApplySubDO> selectListByFk(Long fk) {
        return selectList(OaLeavApplySubDO::getFk, fk);
    }

    default int deleteByFk(Long fk) {
        return delete(OaLeavApplySubDO::getFk, fk);
    }
    default PageResult<OaLeavApplySubDO> selectPage(OaLeavApplySubPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaLeavApplySubDO>()
                .eqIfPresent(OaLeavApplySubDO::getType, reqVO.getType())
                .betweenIfPresent(OaLeavApplySubDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(OaLeavApplySubDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(OaLeavApplySubDO::getSc, reqVO.getSc())
                .betweenIfPresent(OaLeavApplySubDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OaLeavApplySubDO::getFk, reqVO.getFk())
                .eqIfPresent(OaLeavApplySubDO::getTp, reqVO.getTp())
                .eqIfPresent(OaLeavApplySubDO::getBpmDefKey, reqVO.getBpmDefKey())
                .eqIfPresent(OaLeavApplySubDO::getSn, reqVO.getSn())
                .orderByDesc(OaLeavApplySubDO::getId));
    }
}
